package com.fang.web;

import java.io.IOException;
import java.lang.reflect.Method;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class BaseServlet extends HttpServlet{
	
	@Override
	public void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// 获取要执行的方法
		String methodname = req.getParameter("method");
		Class clazz = this.getClass();
		try {
			Method method = clazz.getMethod(methodname,HttpServletRequest.class,HttpServletResponse.class );
			method.invoke(this,req,resp);
		} catch (Exception e) {
			e.printStackTrace();
		} 
	
	}
}
